package com.czxy.servlet;

import cn.itcast.servlet.BaseServlet;
import com.alibaba.fastjson.JSON;
import com.czxy.domain.Words;
import com.czxy.service.WordService;

import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.util.List;


@WebServlet("/wordServlet")
public class WordServlet extends BaseServlet {

    public  void  getWordList() throws IOException {

        //获取前端传递的 word
        String word = getRequest().getParameter("word");

        //调用Service 获取
        WordService service = new WordService();

        List<Words> list = service.getWord(word);


        String s = JSON.toJSONString(list);
        getResponse().getWriter().write(s);






    }



}
